© Zühlke APAC SWEX+DX 2024
© Zühlke APAC SWEX+DX 2024
© Zühlke APAC SWEX+DX 2024
The following libraries will be used in our RAG implementation:
© Zühlke APAC SWEX+DX 2024
© Zühlke APAC SWEX+DX 2024
© Zühlke APAC SWEX+DX 2024
Clone the RAG template repo
git clone https://xxx@dev.azure.com/ZuhlkeAsia/RAG%20Workshop/_git/rag-template
© Zühlke APAC SWEX+DX 2024
Your first task is to implement a simple Helloworld API using FastAPI.
/hello
that returns a JSON response with a message.# Use fastapi-cli to run the server in dev
fastapi dev main.py
# Alternatively, use uvicorn directly
uvicorn main:app --reload
# Or run main via PyCharm (no hot-reload)
© Zühlke APAC SWEX+DX 2024
PYTHONPATH=./backend
# Azure OpenAI api-version. See https://aka.ms/azsdk/azure-ai-inference/azure-openai-api-versions
OPENAI_API_VERSION=2024-06-01
AZURE_OPENAI_ENDPOINT=https://oai-swex-rag-workshop-eastus.openai.azure.com/
AZURE_OPENAI_API_KEY=xxk
AZURE_OPENAI_EMBEDDING_MODEL=text-embedding-3-small
AZURE_OPENAI_CHAT_MODEL=gpt-4o-mini
CHUNK_SIZE=500
AI_SEARCH_ENDPOINT=https://srch-swex-rag-workshop.search.windows.net
AI_SEARCH_API_KEY=xxx
AI_SEARCH_INDEX_NAME=kevin-lin-rag-workshop # TODO: ADAPT THIS WITH YOUR NAME
© Zühlke APAC SWEX+DX 2024
from pydantic import BaseModel
class HelloWorldResponse(BaseModel):
message: str
@app.get("/", response_model=HelloWorldResponse)
def read_root():
return {"message": "Hello, World"}
© Zühlke APAC SWEX+DX 2024